package com.cdream.basic.algorithm.leetcode.dp;

public class Offer10 {
    public int fib(int n) {
        if(n==0){
            return 0;
        }
        if(n==1){
            return 1;
        }
        long[] dp = new long[n];
        dp[0] = 1;
        dp[1] = 1;
        for (int i = 2; i < n; i++) {
            dp[i] = dp[i-1] + dp[i-2];
        }
        return (int) (dp[n-1] % (1e9+7));
    }
}
